var uls = document.querySelector(".lis-r").querySelector("ul")
// console.log(uls)
var name1 = getCookie('name');
// console.log(name1)
//存放当前商品信息的对象
(async function () {
    //获取所有数据
    var txt = await PromiseAjax({
        url: "../php/index.php"
    })
    var ar1 = eval('(' + txt + ')');
    // console.log(ar1)
    var ar2 = ar1.slice(0, 8)
    //创建字符串，存放需要渲染的内容
    var str = ''
    ar2.forEach(item => {
        str += `
        <li>
            <a href="./xiangqing.html?id=${item.id}" data-id="${item.id}">
                <div class="plimg">
                    <img src="${item.src}" alt="">
                </div>
                <h5>DTH-3221/K0-FX</h5>
                <p>4K超清 8192级压感 指触控</p>
                <span>¥${item.price}起 </span>
            </a>
        </li>
        `
    })
    //把当前拼接好的内容，渲染到大盒子中
    uls.innerHTML = str
})()